import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_09_game/base/widget/base_get_builder.dart';
import 'package:flutter_09_game/base/widget/base_list_get_builder.dart';
import 'package:flutter_09_game/config/app_color.dart';
import 'package:flutter_09_game/generated/assets.dart';
import 'package:flutter_09_game/generated/locales.g.dart';
import 'package:flutter_09_game/pages/deposit/models/model_record_team.dart';
import 'package:flutter_09_game/pages/deposit/widgets/widget_record_funds.dart';

// import 'package:flutter_09_game/pages/deposit/widget/widget_record_funds.dart';
import 'package:flutter_09_game/user/app_user_manager.dart';
import 'package:flutter_09_game/utils/log/utils_log.dart';
import 'package:flutter_09_game/utils/utils_other.dart';
import 'package:flutter_09_game/widgets/btn_dropdown.dart';
import 'package:flutter_09_game/widgets/button/debounce_gesture_detector.dart';
import 'package:flutter_09_game/widgets/crypto_tag_selector.dart';
import 'package:flutter_09_game/widgets/empty/empty_no_data.dart';
import 'package:flutter_09_game/widgets/image/auto_image.dart';
import 'package:flutter_09_game/widgets/image/image_view.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import 'deposit_record_team_logic.dart';

class DepositRecordTeamPage extends StatelessWidget {
  DepositRecordTeamPage({super.key, required this.tag});

  final String tag;
  late final DepositRecordTeamLogic logic =
      Get.put(DepositRecordTeamLogic(tag: tag), tag: tag,);

  @override
  Widget build(BuildContext context) {

    // clog('currentIndexcurrentIndex   ${logic.currentIndex}');
    return BaseGetBuilder<DepositRecordTeamLogic>(
      init: logic,
      tag: tag,
      emptyBuilder: () {
        return SizedBox(
          width: 1.sw,
          child: Padding(
            padding: EdgeInsets.only(top: 108.w),
            child: EmptyNoData.notDataView(),
          ),
        );
      },
      bodyTopViewBuilder: (_) {
        return _buildTopCryptoTag();
      },
      builder: (_) {
        return PageView(
          controller: logic.pageController,
          physics: const NeverScrollableScrollPhysics(),
          pageSnapping: false,
          children: logic.pages,
        );
        // return Container();
      },
    );
    // return Container();
  }

  Widget _buildTopCryptoTag() {
    return Obx(() {
      return Container(
        color: AppColor.navBgColor,
        padding: EdgeInsets.all(16.w).copyWith(bottom: 0),
        child: CryptoTagSelector(
          options: UtilsOther.recordTeamOptions,
          selectedValue: logic.selectorTagRx.value,
          onChanged: (value) {
            logic.selectorTagRx.value = value;
            // clog('asdlasjdlkjsa   ${logic.options.indexOf(value)}');
            logic.changeIndex(UtilsOther.recordTeamOptions.indexOf(value));
          },
        ),
      );
    });
  }
}
